package gemini.castor.ui.server.service.impl;

import gemini.basic.manager.UserManager;
import gemini.basic.model.Address;
import gemini.basic.model.User;
import gemini.castor.ui.client.service.UserService;
import gemini.castor.ui.server.service.AbstractSingleService;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class UserServiceImpl extends AbstractSingleService<UserManager>
		implements UserService {

	@SuppressWarnings("unused")
	private final Log logger = LogFactory.getLog(UserServiceImpl.class);

	@Override
	public User getUserByName(String username) {
		User result = duplicateExcludeFields(getServerManager().getUserByName(
				username));
		return result;
	}

	@Override
	public User save(User user) {
		User result = duplicate(getServerManager().save(user));
		return result;
	}

	@Override
	public boolean savePassword(String userName, String password,
			String newPassword) {
		boolean result = getServerManager().savePassword(userName, password,
				newPassword);
		return result;
	}

	@Override
	public boolean savePhone(String userName, String password, String newPhone) {
		boolean result = getServerManager().savePhone(userName, password,
				newPhone);
		return result;
	}

	@Override
	public boolean saveEmail(String userName, String password, String newEmail) {
		boolean result = getServerManager().saveEmail(userName, password,
				newEmail);
		return result;
	}

	@Override
	public boolean saveAddress(String userName, String password,
			Address newAddress) {
		boolean result = getServerManager().saveAddress(userName, password,
				newAddress);
		return result;
	}
}
